//
//  TTGradientColorView.m
//  ITBE
//
//  Created by ITBE on 2019/2/20.
//  Copyright © 2019 ITBE. All rights reserved.
//

#import "TTGradientColorView.h"

@implementation TTGradientColorView
-(instancetype)initWithStartPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint Colors:(NSArray *)colors locations:(NSArray *)locations
{
    self = [super init];
    if (self) {
        currentColors = colors;
        currentEndPoint = endPoint;
        currentStartPoint = startPoint;
        currentLocations = locations;
        hasGradientColor = NO;
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    if (!hasGradientColor) {
        [self gradientColorWithStartPoint:currentStartPoint toPoint:currentEndPoint colors:currentColors locations:currentLocations];
        //[AppUtils gradientColorWithView:self startPoint:currentStartPoint toPoint:currentEndPoint colors:currentColors locations:currentLocations];
        hasGradientColor = YES;
    }
}
@end
